class Solution {
public:
    void dfs(vector<int>& x, vector<int>& y, vector<int>& z,int n)
    {
        if(n==1)
        {
            z.push_back(x.back());
            x.pop_back();
            return;
        }
        dfs(x,z,y,n-1);
        z.push_back(x.back());
        x.pop_back();
        dfs(y,x,z,n-1);
    } 
    void hanota(vector<int>& a, vector<int>& b, vector<int>& c) {
        dfs(a,b,c,a.size());
    }
};
